﻿@model vITs.Site.Models.ActionModels.AddPerDiemModel
@{
    ViewBag.Title = "Lägg till Traktamente";
}
@using (this.Html.BeginForm())
{
    <fieldset>
        <legend>
            <h2>Lägg till Traktamente</h2>
        </legend>
        <div id="assignmentInfo">
            <h3>Uppdrag: @this.ViewBag.Assignment.AssignmentName <span>(@this.ViewBag.Assignment.StartDate.ToString("yyyy-MM-dd") — @this.ViewBag.Assignment.EndDate.ToString("yyyy-MM-dd"))</span></h3> 
        @if (this.ViewBag.Assignment.Breaks.Count > 0)
        {
            <h4>Inrapporterade Uppehåll</h4>
            <ul>
            @foreach (var b in this.ViewBag.Assignment.Breaks)
            {
                <li>@b.StartDate.ToString("yyyy-MM-dd")  — @b.EndDate.ToString("yyyy-MM-dd")</li>
            }
            </ul>
        }
        </div>
        <input type="hidden" name="AssignmentId" id="AssignmentId" value="@this.ViewBag.Assignment.AssignmentId" />
        @this.Html.ValidationSummary(true)
        <br />
        @this.Html.LabelFor(m => m.Country)
        <br />
        @this.Html.EditorFor(m => m.Country) @this.Html.ValidationMessageFor(m => m.Country)
        <br />
        @this.Html.LabelFor(m => m.Date)
        <br />
        @this.Html.EditorFor(m => m.Date) @this.Html.ValidationMessageFor(m => m.Date)
        <br />
        <div id="checkboxes">
            @this.Html.CheckBoxFor(m => m.Breakfast) @this.Html.LabelFor(m => m.Breakfast)
            <br />
            @this.Html.CheckBoxFor(m => m.Lunch) @this.Html.LabelFor(m => m.Lunch)
            <br />
            @this.Html.CheckBoxFor(m => m.Dinner) @this.Html.LabelFor(m => m.Dinner)
        </div>
        <input type="submit" value="Lägg till" />
    </fieldset>
}
@section Sidebar
{
<div>
    <ul>
    @foreach (var item in this.ViewBag.Assignment.PerDiems)
    {
        <li>
            <div>
                <b>@item.Country</b>
                <br />
                <b>@item.Date.ToString("yyyy-MM-dd")</b>
                @if (item.Breakfast)
                {
                    <br />
                    <b>Åt Frukost</b>
                }
                @if (item.Lunch)
                {
                    <br />
                    <b>Åt Lunch</b>
                }
                @if (item.Dinner)
                {
                    <br />
                    <b>Åt Middag</b>
                }
            </div>
            
        </li>
    }
    </ul>
</div>
}

<script src="../../Scripts/jquery-ui-1.8.11.min.js" type="text/javascript"></script>
<link href="../../Content/themes/base/jquery.ui.all.css" media="all" rel="Stylesheet" type="text/css" />
<script type="text/javascript">
    $("#Date").datepicker();
</script>
